<?php

declare(strict_types=1);

use App\Notice\Contract\DataServiceInterface;

use function Hyperf\Support\env;

return [
    'enable' => [
        'discovery' => true,
        'register' => true,
    ],
    'consumers' => [
        [
            'name' => 'DataService',
            'service' => DataServiceInterface::class,
            'protocol' => 'jsonrpc-http',
            'registry' => [
                'protocol' => 'nacos',
                'address' => env('NACOS_HOST', '127.0.0.1') . ':' . env('NACOS_PORT', 8848),
            ],
            'options' => [
                'headers' => [
                    'prefix' => 'Json-Rpc',
                ],
                'timeout' => 2.0,
            ],
        ],
    ],
    'providers' => [],
    'drivers' => [
        'nacos' => [
            // nacos server url like https://nacos.hyperf.io, Priority is higher than host:port
            // 'url' => '',
            // The nacos host info
            'host' => env('NACOS_HOST', '127.0.0.1'),
            'port' => env('NACOS_PORT', 8848),
            // The nacos account info
            // 'username' => null,
            // 'password' => null,
            'guzzle' => [
                'config' => null,
            ],
            'group_name' => env('NACOS_GROUP', 'dev'),
            'namespace_id' => env('NACOS_NAMESPACE_ID', 'namespace_id'),
            'heartbeat' => 5,
            'ephemeral' => true,
        ],
    ],
];
